import java.io.FileNotFoundException;
import java.util.Timer;
import java.util.TimerTask;

import javax.swing.JFrame;

import DataReading.LoadSystem;
import DataReading.Vessel;
import DataReading.VesselList;
import UserInterface.initUI;
import UserInterface.login;
import DataReading.*;

public class Driver{
	
	public static void main(String[] args) throws FileNotFoundException {
				
		login radarSimulator = new login(); // creates login UI
//		LoadSystem x = new LoadSystem("comp354_vessel.vsf");
//		x.updateVessalPositions(0);
//		initUI test = new initUI("Administrator");
		
//		Timer timer = new Timer();
//		LoadSystem x = new LoadSystem("test.vsf");
//		int timeStep = x.getInfo().getTimeStep();
//		MyTask t = new MyTask(x);
//    	x.updateVessalPositions(494);
//    	System.out.println(x.displayTable());
//    	x.updateVessalPositions(495);
//    	System.out.println(x.displayTable());
		//timer.schedule(t, 0, (timeStep * 1000));	
//		
	}

}
// Timer Class
class MyTask extends TimerTask {
    private LoadSystem x;
    private int timeStep;
    private int currentTime;
    private int maxTime;
    
    // Constructor
    public MyTask(LoadSystem x) {
    	this.x = x;
    	this.timeStep = x.getInfo().getTimeStep();
    	this.currentTime = x.getInfo().getStartTime();
    	this.maxTime = x.getInfo().getTime();
    }
 
 
    // Method that runs on every timer call
    public void run() {
    	System.out.println("\n TIMESTEP: "+currentTime);
    	x.updateVessalPositions(currentTime);
    	System.out.println(x.displayTable());
    	currentTime += timeStep;
    	if (currentTime > maxTime) {
    		this.cancel();
    	}
    	
    }

}


